package com.workcell.workdata.im.model.dto;

import com.fasterxml.jackson.annotation.JsonProperty;

public class BaiduTranslateResult {

    @JsonProperty(value = "trans_result")
    private Result[] transResult;

    public static class Result{
        private String dst;
        public void setDst(String dst) {
            this.dst = dst;
        }
    }

    public void setTransResult(Result[] transResult) {
        this.transResult = transResult;
    }

    public String getText(){

        StringBuilder builder = new StringBuilder();

        if (transResult == null || transResult.length == 0){
            return null;
        }

        for (Result result : transResult){
            builder.append(result.dst).append("\n\n");
        }

        builder.deleteCharAt(builder.length() - 1);
        builder.deleteCharAt(builder.length() - 1);

        return builder.toString();
    }
}
